<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="/WEB-INF/jspf/common-imports.jspf" %>
<title>회원리스트</title>

	<script type="text/javascript">
	
		function initEvetnHandler() {
			$("#btn_list").click(function(){
				doList();
			});
		}
		
		/** 조회 **/
		function doList() {
			$.invokeGET(
				"/rest/MEMBER/list",
				$("#cid_list_frm"),
				function(model) {
					var html = "";
					var data = model.MODEL;
					
					if (data.length > 0 ) {
						$("#cid_panel_list > tbody").html('');
						for (var i = 0; i < data.length; i++) {
							html = "";
							html += "<tr onclick='javascript:doView(\""+data[i].seq+"\")'>";
							html += "	<th>"+data[i].seq+"</th>";
							html += "	<th>"+data[i].name+"</th>";
							html += "	<th>"+data[i].id+"</th>";
							html += "	<th>"+data[i].tel+"</th>";
							if (data[i].last_login_dt != null && data[i].last_login_dt != "") {
								html += "	<th>"+data[i].last_login_dt.toDate().format("yyyy-MM-dd","date")+"</th>";
							} else {
								html += "	<th></th>";
							}

							html += "	<th>"+data[i].reg_dt.toDate().format("yyyy-MM-dd","date")+"</th>";
							html += "	<th>정회원등록</th>";
							html += "</tr>";
							$("#cid_panel_list > tbody").append(html);
						}
						
					} else {
						alert("조회 내용 읍음");
					}
					
					makePagingControl(
						$("#cid_pageing"),
						$("#page_no").val(),
						model.TOTAL_PAGE_COUNT,
						5, 
						function(p) {
							$("#page_no").val(p);
							doList();
						}
					)
				}
			);	
		}		
		
		/** 상세조회 (뷰) **/
		function doView(idx) {
			
			// 리스트를 안보이게 하기
			$("#cid_area_list").hide();
			
			$.invokeGET(
				'/rest/MEMBER/'+idx,
				null,
				function(model) {
					var data = model.MODEL;
					$("#cid_view_id").text(data.id);
					$("#cid_view_pw").text(data.pw);
					$("#cid_view_name").text(data.name);
					$("#cid_view_zipcode").text(data.zipcode);
					$("#cid_view_addr1").text(data.addr1);
					$("#cid_view_addr2").text(data.addr2);
					$("#cid_view_update_dt").text(data.update_dt);
					$("#cid_view_email").text(data.email);
					$("#cid_view_tel").text(data.tel);
					$("#cid_view_last_login_dt").text(data.last_login_dt);
					$("#cid_view_reg_dt").text(data.reg_dt);
					$("#cid_view_seq").val(data.seq);
					$("#cid_area_view").show();
				}
			);
		}
				
		$(document).ready(function() {
			doList();
		});
	</script>
</head>
<body>
	<!-- =============================================== menu 시작 -->
	<a href="/">홈으로</a>
	<!-- =============================================== menu 끝 -->
	
	<!-- =============================================== content 시작 -->

	<!-- 리스트 시작 -->
	<div id="cid_area_list">
		<form id="cid_list_frm" id="cid_list_frm" >
		<!-- 검색 시작 -->
		<table width="100%" border="1" cellpadding="0" cellspacing="0">
			<tr>
				<th>
					검색조건 :
					<select name="src_type">
						<option value="">전체</option>
						<option value="name">성명</option>
						<option value="id">아이디</option>
						<option value="black">블랙회원</option>
						<option value="not_black">정회원</option>
					</select> 
					<input type="text" name="src_keyword" id="src_keyword" value=""/>
					<a href="#" id="btn_list">[검색]</a>
				</th>
				
			</tr>
		</table>
		<!-- 검색 끝 -->
	
		<!-- 버튼 시작 -->
		<div style="text-align:right">
			[회원삭제]
			[회원등록] 
		</div>
		<!-- 버튼 끝 -->
		
		<table id="cid_panel_list" width="100%" border="1" cellpadding="0" cellspacing="0">
			<thead>
			<tr>
				<th>번호</th>
				<th>성명</th>
				<th>아이디</th>
				<th>연락처</th>
				<th>최종로그인</th>
				<th>생성일</th>
				<th>기능</th>
			</tr>
			</thead>
			
			<tbody></tbody>
			
			<tfoot>
			<tr>
				<th colspan="7" id="cid_pageing">페이징</th>
			</tr>
			</tfoot>
		</table>
		
		<input type="hidden" id="page_no" name="page_no" value="1"/>
		<input type="hidden" id="member_seq" name="member_seq" value=""/>
		</form>
	</div>
	<!-- 리스트 끝 -->
	
	<!-- 등록 페이지 시작 -->
	<div id="cid_area_reg" style="display:none">
		<form name="cid_reg_frm" id="cid_reg_frm">
		<table width="100%" border="1" cellpadding="0" cellspacing="0">
			<caption>회원정보 등록</caption>
			<tbody>
			<tr>
				<th>아이디</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>비밀번호</th>
				<td><input type="password" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>비밀번호확인</th>
				<td><input type="password" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>이름</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>이메일</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>연락처</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>우편번호</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>주소</th>
				<td><input type="text" name="" id="" value=""/> (기본 배송지로 설정됩니다)</td>
			</tr>
			<tr>
				<th>상세주소</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
	
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2" align="center">
						[닫기]
						[회원가입]
					</td>
				</tr>
			</tfoot>
		</table>
		</form>
	</div>
	<!-- 등록 페이지 끝 -->
	
	<!-- 상세 페이지 시작 -->
	<div id="cid_area_view" style="display:none">
		<form name="cid_view_frm" id="cid_view_frm">	
		<table width="100%" border="1" cellpadding="0" cellspacing="0">
			<caption>회원정보 상세</caption>
			<tbody>
			<tr>
				<th>아이디</th>
				<td id="cid_view_id"></td>
			</tr>
			<tr>
				<th>비밀번호</th>
				<td id="cid_view_pw"></td>
			</tr>
			<tr>
				<th>이름</th>
				<td id="cid_view_name"></td>
			</tr>
			<tr>
				<th>이메일</th>
				<td id="cid_view_email"></td>
			</tr>
			<tr>
				<th>연락처</th>
				<td id="cid_view_tel"></td>
			</tr>
			<tr>
				<th>우편번호</th>
				<td id="cid_view_zipcode"></td>
			</tr>
			<tr>
				<th>주소</th>
				<td>
					<span id="cid_view_addr1"></span><br/>
					<span id="cid_view_addr2"></span>
				</td>
			</tr>
			<tr>
				<th>가입일</th>
				<td id="cid_view_reg_dt"></td>
			</tr>
			<tr>
				<th>수정일</th>
				<td id="cid_view_update_dt"></td>
			</tr>
			<tr>
				<th>최종로그인시간</th>
				<td id="cid_view_last_login_dt"></td>
			</tr>
			<tr>
				<th>회원등급</th>
				<td></td>
			</tr>
			<tr>
				<th>블랙회원 사유</th>
				<td></td>
			</tr>
			<tr>
				<th>탈퇴 사유</th>
				<td></td>
			</tr>
			
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2" align="center">
						[닫기]
						[수정]
					</td>
				</tr>
			</tfoot>
		</table>
		</form>
	</div>
	<!-- 상세 페이지 끝 -->
	
	<!-- 수정 페이지 시작 -->
	<div id="cid_area_detail" style="display:none">
		<form name="cid_detail_frm" id="cid_detail_frm">
	
		<table width="100%" border="1" cellpadding="0" cellspacing="0">
			<caption>회원정보 수정</caption>
			<tbody>
			<tr>
				<th>아이디</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>비밀번호</th>
				<td><input type="password" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>비밀번호확인</th>
				<td><input type="password" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>이름</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>이메일</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>연락처</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>우편번호</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
			<tr>
				<th>주소</th>
				<td><input type="text" name="" id="" value=""/> (기본 배송지로 설정됩니다)</td>
			</tr>
			<tr>
				<th>상세주소</th>
				<td><input type="text" name="" id="" value=""/></td>
			</tr>
	
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2" align="center">
						[닫기]
						[정회원으로 변경]
						[수정완료]
					</td>
				</tr>
			</tfoot>
		</table>
		</form>
	</div>
	<!-- 수정 페이지 끝 -->
	
	<!-- 블랙리스트 등록 -->	
	<div id="cid_area_black_reg" style="display:none">
		<form name="cid_black_reg_frm" id="cid_black_reg_frm">
	
		<table  border="1" cellpadding="0" cellspacing="0">
			<caption>블랙리스트 등록</caption>
			<tbody>
			<tr>
				<th>아이디</th>
				<td>ㅌㅌㅌㅌㅌㅌㅌㅌㅌ</td>
				<th>성명</th>
				<td>ㅌㅌㅌㅌㅌㅌㅌㅌㅌ</td>
			</tr>
			<tr>
				<td>사유</td>
				<td colspan="3">
					<textarea></textarea>
				</td>
			</tr>
			</tbody>
			<tfoot>
			<tr>
				<td colspan="4">[취소][블랙회원등록]</td>
			</tr>
			</tfoot>
		</table>
		</form>
	</div>
	<!-- 블랙리스트 등록 -->
	
	<!-- 블랙리스트 상세 -->	
	<!-- 블랙리스트 등록 -->	
	
		
	<!-- =============================================== content 끝 -->
	<!-- =============================================== footer 시작 -->
	<!-- =============================================== footer 끝 -->	
</body>
</html>